<?php

namespace Data;

/**
 * Description of Massage
 *
 * @author dongasai
 */
class Massage
{

    /**
     *
     * @param type $msg 消息内容
     * @param type $f_c 来自客户端
     * @param type $t_c 前往客户端
     * @param type $type 消息类型
     */
    public static function msg($msg, $f_c, $append = [], $t_c = 'all', $type = 'text')
    {
        $data = [
            'msg'      => $msg,
            'form_uid' => $f_c,
            'to_uid'   => $t_c,
            'type'     => $type,
            'append'   => $append
        ];
        return json_encode($data);
    }

    public static function receipt($state, $f_c, $append = [], $t_c = false)
    {
        $t_c === false && $t_c  = $f_c;
        $data = [
            'form_uid' => $f_c,
            'to_uid'   => $t_c,
            'type'     => 'receipt',
            'status'   => $state,
            'append'   => $append
        ];
        return json_encode($data);
    }

}
